﻿@model List<Data.Models.PriceMaterial>
<div class="btn-group">
    <a href='#' class="btn btn-warning btn-sm dropdown-toggle link" onclick='Print(); return false;'>In báo cáo</a>
</div>
<div class="btn-group">
    <button class="btn btn-warning btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bars"></i>Export Table Data</button>
    <ul class="dropdown-menu " role="menu">
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'json',escape:'false'});">
            <img src='/Report/JS/icons/json.png' width='24px'>
            JSON</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'json',escape:'false',ignoreColumn:'[2,3]'});">
            <img src='/Report/JS/icons/json.png' width='24px'>
            JSON (ignoreColumn)</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'json',escape:'true'});">
            <img src='/Report/JS/icons/json.png' width='24px'>
            JSON (with Escape)</a></li>
        <li class="divider"></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'xml',escape:'false'});">
            <img src='/Report/JS/icons/xml.png' width='24px'>
            XML</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'sql'});">
            <img src='/Report/JS/icons/sql.png' width='24px'>
            SQL</a></li>
        <li class="divider"></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'csv',escape:'false'});">
            <img src='/Report/JS/icons/csv.png' width='24px'>
            CSV</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'txt',escape:'false'});">
            <img src='/Report/JS/icons/txt.png' width='24px'>
            TXT</a></li>
        <li class="divider"></li>

        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'excel',escape:'false'});">
            <img src='/Report/JS/icons/xls.png' width='24px'>
            XLS</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'doc',escape:'false'});">
            <img src='/Report/JS/icons/word.png' width='24px'>
            Word</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'powerpoint',escape:'false'});">
            <img src='/Report/JS/icons/ppt.png' width='24px'>
            PowerPoint</a></li>
        <li class="divider"></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'png',escape:'false'});">
            <img src='/Report/JS/icons/png.png' width='24px'>
            PNG</a></li>
        <li><a href="#" onclick="$('#tblMaterial').tableExport({type:'pdf',escape:'false'});">
            <img src='/Report/JS/icons/pdf.png' width='24px'>
            PDF</a></li>
    </ul>

</div>

<table class="table" style="width: 100%" id="tblMaterial">
    <thead>
        <tr>
            <th>Mã
            </th>
            <th>Tên
            </th>
            <th>Chi phí nguyên vật liệu
            </th>
            <th>Chi phí nhân công
            </th>
            <th>Chi phí công cụ sản xuất
            </th>
            <th>Chi phí khác
            </th>
            <th>Tổng chi phí
            </th>
        </tr>
    </thead>
    <tbody id="Stock">
        @foreach (var item in Model)
        { 
            <tr>
                <td style="word-break: break-all; width: 150px;">@item.Code</td>
                <td style="word-break: break-all; width: 250px;">@item.Name</td>
                <td style="word-break: break-all; width: 250px;">@item.MaterialCost</td>
                <td style="word-break: break-all; width: 250px;">@item.LabourCost</td>
                <td style="word-break: break-all; width: 250px;">@item.ToolCost</td>
                <td style="word-break: break-all; width: 250px;">@item.OtherCost</td>
                <td style="word-break: break-all; width: 250px;">@item.TotalCost</td>
            </tr>
        }
    </tbody>
</table>
<script src="@Url.Content("~/Report/JS/tableExport.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Report/JS/jquery.base64.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Report/JS/html2canvas.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Report/JS/jspdf/libs/sprintf.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Report/JS/jspdf/jspdf.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Report/JS/jspdf/libs/base64.js")" type="text/javascript"></script>
<script>
    function Print() {
        location.href = "/PriceMaterial/Print/" + $("#OrderID").val();
    }
</script>
